<template>
    <vxe-column
            resizable
            show-overflow
            show-header-overflow
            show-footer-overflow
            :edit-render="item.editRender"
            :sortable="item.sortable"
            :field="item.key || item.field"
            :type="item.type"
            :min-width="item.minWidth"
            :width="item.width"
            :visible="!item.hidden"
            :fixed="item.fixed"
            :align="item.align"
            :header-align="item.headerAlign"
            :footer-align="item.footerAlign"
            :class-name="item.className"
            :header-class-name="item.headerClassName"
            :footer-class-name="item.footerClassName"
            :formatter="item.formatter"
            :filters="item.filter"
            :filter-multiple="item.filterMultiple"
            :filter-method="(e)=>item.filterMethod(e)"
            :filter-reset-method="item.filterResetMethod"
            :filter-recover-method="item.filterRecoverMethod"
            :filter-render="item.filterRender"
            :title="item.title"
            v-bind="item.config"
    >
        <template #edit="slotParams"  v-if="item.render && item.model=== 'edit'">
            <component :is="item.render(slotParams)"></component>
        </template>
        <template #default="slotParams"  v-if="item.render && item.model=== 'edit'">
            <component :is="item.render(slotParams)" ></component>
        </template>
        <template #default="slotParams" v-if="!item.formatter && !item.render && !item.type && !item.model && !item.expandRender || (item.render && !item.type && !item.model) || (item.render && item.type ==='expand')">
            <div v-if="!item.render">{{slotParams.row[item.key] || '-'}}</div>
            <component :is="item.render(slotParams)" v-if="item.render"></component>
        </template>
        <template #header="slotParams" v-if="item.titleRender">
            <component :is="item.titleRender(slotParams)"></component>
        </template>
        <template #footer="slotParams" v-if="item.footerRender">
            <component :is="item.footerRender(slotParams)"></component>
        </template>
        <template #content="expandSlotParams" v-if="item.type ==='expand' && item.expandRender">
            <component :is="item.expandRender(expandSlotParams)" ></component>
        </template>
    </vxe-column>
</template>

<script setup>
defineProps({
    item:{
        type:Object,
        default:()=>{}
    }
})
</script>

<style scoped>

</style>